package com.io.copys;

import org.junit.Test;

import java.io.File;

public class Moves {
    public static void main(String[] args) {
        System.out.println("文件移动");
    }

    @Test
    public void move() {
        String src = "D:\\a.txt";
        // 目标路径
        String target = "E:\\a.txt";
        // 操作文件
        File file = new File(src);
        File move = new File(target);
        boolean b = file.renameTo(move);
        if (b) {
            System.out.println("移动成功！");
        } else {
            System.out.println("移动失败！");
        }
    }
}
